﻿using LeRenard.Core.Numbers;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using Xunit;

namespace LeRenard.Core.Tests._extensions_
{
    public class IRangeExtensionsTests
    {
        [Fact]
        public void AsEnumerable_For_Int32Range_Returns_All_Elements()
        {
            // Arrange
            var sut = new Int32Range(1, 9);
            var expected = new List<int> { 1, 2, 3, 4, 5, 6, 7, 8, 9 };

            // Act
            var actual = sut.AsEnumerable();            

            // Assert
            Assert.Equal(expected.Count, actual.Count());
            for (int i = 0; i < expected.Count; i++) {
                Assert.Equal(expected[i], actual.ElementAt(i));
            }                
        }
    }
}
